using MicroMsg.Manager;
using MicroMsg.Plugin.FaceBook;
using MicroMsg.Resource.@string;
using MicroMsg.Storage;
using MicroMsg.UI.UserContrl;
using MicroMsg.UI.Util;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
namespace MicroMsg.UI.Page
{
	public class FriendsIntroducePluginView : ChatContainerPage
	{
		private bool mBPageIsNotFirstIn;
		internal Grid LayoutRoot;
		internal Grid realLayoutRoot;
		internal Grid ContentPanel;
		internal Image ImgPlugin;
		internal TextBlock txtPluginName;
		internal Image icon_Installed;
		internal TextBlock txtIsInstalled;
		internal StackPanel panelBottom;
		internal TextBlock txtPluginDetail;
		internal Button btnViewMessages;
		internal StackPanel CanvasAlreadyBindQQ;
		internal MMToggleSwitch switchQQPush;
		internal StackPanel CanvasNoBindQQ;
		internal Button btnBindQQ;
		internal TextBlock txtPluginName_Copy2;
		internal StackPanel CanvasAlreadyBindPhone;
		internal MMToggleSwitch switchMobliePush;
		internal StackPanel CanvasNoBindPhone;
		internal Button btnBindPhone;
		internal TextBlock txtPluginName_Copy3;
		internal StackPanel CanvasAlreadyBindFaceBook;
		internal MMToggleSwitch switchFaceBookPush;
		internal StackPanel CanvasNoBindFaceBook;
		internal Button btnBindFaceBook;
		internal TextBlock txtPluginName_Copy4;
		private bool _contentLoaded;
		public FriendsIntroducePluginView()
		{
			this.InitializeComponent();
			base.add_Loaded(new RoutedEventHandler(this.PageLoaded));
		}
		protected override void OnPageIn(object[] object_0)
		{
			if (this.mBPageIsNotFirstIn)
			{
				return;
			}
			this.mBPageIsNotFirstIn = true;
			this.panelBottom.set_Visibility(1);
		}
		protected override void OnPageOut()
		{
		}
		private void PageLoaded(object sender, RoutedEventArgs e)
		{
			this.initUI();
		}
		private void initUI()
		{
			this.ImgPlugin.set_Source(HeadImgMgr.getHeadImage("fmessage", true));
			Account curAccount = AccountMgr.getCurAccount();
			if (!ToolFunction.checkIsPhoneNumber(curAccount.strBindMobile))
			{
				this.CanvasAlreadyBindPhone.set_Visibility(1);
				this.CanvasNoBindPhone.set_Visibility(0);
			}
			else
			{
				this.CanvasAlreadyBindPhone.set_Visibility(0);
				this.CanvasNoBindPhone.set_Visibility(1);
			}
			if (curAccount.nBindQQ == 0u)
			{
				this.CanvasAlreadyBindQQ.set_Visibility(1);
				if (FaceBookMgr.IsChina())
				{
					this.CanvasNoBindQQ.set_Visibility(0);
				}
				else
				{
					this.CanvasNoBindQQ.set_Visibility(1);
				}
			}
			else
			{
				this.CanvasAlreadyBindQQ.set_Visibility(0);
				this.CanvasNoBindQQ.set_Visibility(1);
			}
			if (curAccount.FaceBookFlag <= 0u)
			{
				this.CanvasAlreadyBindFaceBook.set_Visibility(1);
				this.CanvasNoBindFaceBook.set_Visibility(0);
			}
			else
			{
				this.CanvasAlreadyBindFaceBook.set_Visibility(0);
				this.CanvasNoBindFaceBook.set_Visibility(1);
			}
			if (FaceBookMgr.IsChina())
			{
				this.CanvasNoBindFaceBook.set_Visibility(1);
				this.CanvasAlreadyBindFaceBook.set_Visibility(1);
			}
			this.panelBottom.set_Visibility(0);
			this.initSwitch();
		}
		private void initSwitch()
		{
			this.switchQQPush.Text = strings.Con_FMsg_TxtIntroQQHint;
			if (AccountMgr.DisableRecommendQQFriendsToMe)
			{
				this.switchQQPush.IsChecked = false;
			}
			else
			{
				this.switchQQPush.IsChecked = true;
			}
			this.switchQQPush.onToggleStateChanged = new OnToggleStateChanged(this.switchQQPushStateChanged);
			this.switchMobliePush.Text = strings.Con_FMsg_TxtIntroMHint;
			if (AccountMgr.DisableRecommendMobileFirendsToMe)
			{
				this.switchMobliePush.IsChecked = false;
			}
			else
			{
				this.switchMobliePush.IsChecked = true;
			}
			this.switchMobliePush.onToggleStateChanged = new OnToggleStateChanged(this.switchMobliePushStateChanged);
			if (AccountMgr.RecommendFacebookToMe)
			{
				this.switchFaceBookPush.IsChecked = true;
			}
			else
			{
				this.switchFaceBookPush.IsChecked = false;
			}
			this.switchFaceBookPush.Text = strings.FaceBookRecommend;
			this.switchFaceBookPush.onToggleStateChanged = new OnToggleStateChanged(this.switchFaceBookStateChanged);
		}
		private void btnViewMessages_Click(object sender, EventArgs e)
		{
			ChatContainerPage.GoToChatPage(this, "fmessage", null, null, null);
		}
		private void switchQQPushStateChanged(object sender, bool isCheckOn)
		{
			if (isCheckOn)
			{
				AccountMgr.DisableRecommendQQFriendsToMe = false;
				return;
			}
			AccountMgr.DisableRecommendQQFriendsToMe = true;
		}
		private void switchMobliePushStateChanged(object sender, bool isCheckOn)
		{
			if (isCheckOn)
			{
				AccountMgr.DisableRecommendMobileFirendsToMe = false;
				return;
			}
			AccountMgr.DisableRecommendMobileFirendsToMe = true;
		}
		private void btnBindQQ_Click(object sender, RoutedEventArgs e)
		{
			string text = "findFriend";
			ToolFunction.GotoPageForUserControl("/Source/UI/QQFriends/GoBindQQ.xaml", new object[]
			{
				text
			}, false);
		}
		private void btnBindPhone_Click(object sender, RoutedEventArgs e)
		{
			ToolFunction.GotoPageForUserControl("/Source/UI/PhoneContact/PhoneNumBinding.xaml", null, false);
		}
		protected override bool IsAlertMsgNeedShow(ChatMsg chatMsg_0)
		{
			bool flag = true;
			return !base.PreIsAlertMsgNeedShow(chatMsg_0, ref flag) || flag;
		}
		public override List<UIElement> GetBkContents()
		{
			List<UIElement> list = new List<UIElement>();
			list.Add(this.realLayoutRoot);
			return list;
		}
		public override Panel GetChatContainerPanel()
		{
			return this.LayoutRoot;
		}
		protected override void resumeFromChat()
		{
		}
		protected override void OnBackKeyPress(CancelEventArgs cancelEventArgs_0)
		{
			base.PreOnBackKeyPress(cancelEventArgs_0);
		}
		private void btnBindFaceBook_Click(object sender, RoutedEventArgs e)
		{
			FaceBookBind.ShowBindPage(this, false);
		}
		private void switchFaceBookStateChanged(object sender, bool isCheckOn)
		{
			if (isCheckOn)
			{
				AccountMgr.RecommendFacebookToMe = true;
				return;
			}
			AccountMgr.RecommendFacebookToMe = false;
		}
		[DebuggerNonUserCode]
		public void InitializeComponent()
		{
			if (this._contentLoaded)
			{
				return;
			}
			this._contentLoaded = true;
			Application.LoadComponent(this, new Uri("/MicroMsg;component/Source/UI/Contact/FriendsIntroducePluginView.xaml", 2));
			this.LayoutRoot = (Grid)base.FindName("LayoutRoot");
			this.realLayoutRoot = (Grid)base.FindName("realLayoutRoot");
			this.ContentPanel = (Grid)base.FindName("ContentPanel");
			this.ImgPlugin = (Image)base.FindName("ImgPlugin");
			this.txtPluginName = (TextBlock)base.FindName("txtPluginName");
			this.icon_Installed = (Image)base.FindName("icon_Installed");
			this.txtIsInstalled = (TextBlock)base.FindName("txtIsInstalled");
			this.panelBottom = (StackPanel)base.FindName("panelBottom");
			this.txtPluginDetail = (TextBlock)base.FindName("txtPluginDetail");
			this.btnViewMessages = (Button)base.FindName("btnViewMessages");
			this.CanvasAlreadyBindQQ = (StackPanel)base.FindName("CanvasAlreadyBindQQ");
			this.switchQQPush = (MMToggleSwitch)base.FindName("switchQQPush");
			this.CanvasNoBindQQ = (StackPanel)base.FindName("CanvasNoBindQQ");
			this.btnBindQQ = (Button)base.FindName("btnBindQQ");
			this.txtPluginName_Copy2 = (TextBlock)base.FindName("txtPluginName_Copy2");
			this.CanvasAlreadyBindPhone = (StackPanel)base.FindName("CanvasAlreadyBindPhone");
			this.switchMobliePush = (MMToggleSwitch)base.FindName("switchMobliePush");
			this.CanvasNoBindPhone = (StackPanel)base.FindName("CanvasNoBindPhone");
			this.btnBindPhone = (Button)base.FindName("btnBindPhone");
			this.txtPluginName_Copy3 = (TextBlock)base.FindName("txtPluginName_Copy3");
			this.CanvasAlreadyBindFaceBook = (StackPanel)base.FindName("CanvasAlreadyBindFaceBook");
			this.switchFaceBookPush = (MMToggleSwitch)base.FindName("switchFaceBookPush");
			this.CanvasNoBindFaceBook = (StackPanel)base.FindName("CanvasNoBindFaceBook");
			this.btnBindFaceBook = (Button)base.FindName("btnBindFaceBook");
			this.txtPluginName_Copy4 = (TextBlock)base.FindName("txtPluginName_Copy4");
		}
	}
}
